package com.zqh.cli.command;

import cn.hutool.core.convert.Convert;
import java.nio.file.Paths;
import cn.hutool.core.io.FileUtil;
import picocli.CommandLine.Command;

import java.io.File;
import java.util.List;

@Command(name = "list",description = "查看文件列表",mixinStandardHelpOptions = true)
public class ListCommand implements Runnable {


    @Override
    public  void run() {
        // 输入路径
        String inputPath = ".source/springboot-init-master";
        List<File> files = FileUtil.loopFiles(inputPath);

        for (File file : files) {
            String strs = file.getAbsolutePath(); // 获取文件的绝对路径
            String str = FileUtil.getLastPathEle(file.toPath()) // 使用 file.toPath() 来获取 Path 对象
            .getFileName()
            .toString();
            System.out.println(str);
        }

}

//    public static void main(String[] args) {
//        int exitCode = new CommandLine(new ListCommand()).execute(args);
//        System.exit(exitCode);
//
//    }

}
